import request from '@/sheep/request';

export default {
  getArchives: (data) =>
    request({
      url: '/addons/cms/api.archives/index',
      method: 'GET',
      custom: {
        showLoading: false,
        auth: false,
      },
	  params:{
		  ...data
	  }
    }),
getCategory: (data) =>
  request({
	url: '/addons/cms/api.common/getCategory',
	method: 'GET',
	custom: {
	  showLoading: false,
	  auth: false,
	},
	  params:{
		  ...data
	  }
  }),
  initData: () =>
    request({
  	url: '/addons/cms/api.common/init',
  	method: 'GET',
  	custom: {
  	  showLoading: false,
  	  auth: false,
  	}
    }),
	search: (data) =>
	  request({
		url: '/addons/cms/api.search/index',
		method: 'GET',
		custom: {
		  showLoading: false,
		  auth: false,
		},
		params:{
			...data
		}
	}),
  append1: (data) =>
    request({
      url: 'cart/update',
      method: 'POST',
      custom: {
        showSuccess: true,
        successMsg: '已添加到购物车~',
      },
      data: {
        ...data,
        type: 'inc',
      },
    }),
  // 删除购物车
  delete1: (ids) =>
    request({
      url: 'cart/delete',
      method: 'DELETE',
      params: {
        id: ids.toString(),
      },
    }),
  update1: (data) =>
    request({
      url: 'cart/update',
      method: 'POST',
      data: {
        ...data,
        type: 'cover',
      },
    }),
	//富文本
	richtext: (id) =>
	  request({
	    url: '/addons/cms/api.archives/index',
	    method: 'GET',
	    params: {
	      id: id,
	    },
	  }),
};
